﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:h="clr-namespace:HSS.Interlink.UI" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	mc:Ignorable="d">

	<!-- UploadFile -->
	<DataTemplate DataType="h:UploadFile">
		<ContentControl x:Name="UploadFileControl">
			<ContentControl.Resources>
				<h:ByteConverter x:Key="byteConverter" />
				<h:PercentageConverter x:Key="percentageConverter" />
				<h:VisibilityConverter x:Key="visibilityConverter" />
				<!-- ImageButtonStyle -->
				<Style x:Key="ImageButtonStyle" TargetType="Button">
					<Setter Property="Template">
						<Setter.Value>
							<ControlTemplate TargetType="Button">
								<Grid>
									<VisualStateManager.VisualStateGroups>
										<VisualStateGroup x:Name="CommonStates">
											<VisualState x:Name="Normal" />
											<VisualState x:Name="MouseOver" />
											<VisualState x:Name="Pressed" />
											<VisualState x:Name="Disabled">
												<Storyboard>
													<DoubleAnimation Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity" Duration="0" To=".55" />
												</Storyboard>
											</VisualState>
										</VisualStateGroup>
										<VisualStateGroup x:Name="FocusStates">
											<VisualState x:Name="Focused" />
											<VisualState x:Name="Unfocused" />
										</VisualStateGroup>
									</VisualStateManager.VisualStateGroups>
									<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="Right" VerticalAlignment="Center">
										<Image Source="{TemplateBinding Content}" />
									</ContentPresenter>
									<Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" IsHitTestVisible="false" Opacity="0" RadiusX="2" RadiusY="2" />
								</Grid>
							</ControlTemplate>
						</Setter.Value>
					</Setter>
				</Style>
			</ContentControl.Resources>
			<Grid x:Name="LayoutRoot" Background="Transparent">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="20" />
					<ColumnDefinition Width="*" />
					<ColumnDefinition Width="70" />
					<ColumnDefinition Width="70" />
					<ColumnDefinition Width="65" />
					<ColumnDefinition Width="45" />
				</Grid.ColumnDefinitions>
				<Button Grid.Column="0" Height="16" Width="16" Cursor="Hand" IsTabStop="False" Style="{StaticResource ImageButtonStyle}" Command="{Binding ShowDetailCommand}" Content="/HSS.Interlink.UI;component/assets/information.png" ToolTipService.Placement="Top" ToolTipService.ToolTip="View file info..." />
				<TextBlock Grid.Column="1" Width="{Binding FileNameWidth}" Text="{Binding FileName}" Foreground="{Binding FileNameColor}" ToolTipService.ToolTip="{Binding ToolTipText}" />
				<TextBlock Grid.Column="2" Margin="8,0,0,0" Text="{Binding State}" TextAlignment="Left" Foreground="{Binding FileStateColor}" />
				<TextBlock Grid.Column="3" Margin="8,0,0,0" Text="{Binding FileLength, Converter={StaticResource byteConverter}}" TextAlignment="Left" Foreground="{Binding FileSizeColor}" />
				<Grid Grid.Column="4" Margin="8,0,0,0" >
					<ProgressBar IsTabStop="False" Value="{Binding Percentage}" />
					<TextBlock Text="{Binding Percentage, Converter={StaticResource percentageConverter}}" TextAlignment="Center" />
				</Grid>
				<StackPanel x:Name="Actions" Grid.Column="5" Orientation="Horizontal" Margin="8,0,0,0" HorizontalAlignment="Center" >
					<Button Cursor="Hand" IsTabStop="False" Height="15" Width="16" HorizontalAlignment="Center" Style="{StaticResource ImageButtonStyle}" ToolTipService.Placement="Top" ToolTipService.ToolTip="{Binding FileName, StringFormat='Remove \{0\} ...'}" Command="{Binding RemoveCommand}" Content="/HSS.Interlink.UI;component/assets/remove.png" Visibility="{Binding IsRemoveButtonVisible, Converter={StaticResource visibilityConverter}}"/>
					<Button Cursor="Hand" IsTabStop="False" Height="15" Width="16" HorizontalAlignment="Center" Style="{StaticResource ImageButtonStyle}" ToolTipService.Placement="Top" ToolTipService.ToolTip="{Binding FileName, StringFormat='Cancel \{0\} ...'}" Command="{Binding CancelCommand}" Content="/HSS.Interlink.UI;component/assets/cancel.png" Visibility="{Binding IsCancelButtonVisible, Converter={StaticResource visibilityConverter}}"/>
				</StackPanel>
			</Grid>
			<h:ContextMenu.Attached>
				<h:ContextMenu>
					<h:ContextMenu.MenuItems>
						<h:ContextMenuItem CommandName="CancelCommand" Image="/HSS.Interlink.UI;component/assets/cancel.png" Text="Cancel" />
						<h:ContextMenuItem CommandName="RemoveCommand" Image="/HSS.Interlink.UI;component/assets/remove.png" Text="Remove" />
						<h:ContextMenuItem CommandName="ShowDetailCommand" Image="/HSS.Interlink.UI;component/assets/information.png" Text="View Detail" />
					</h:ContextMenu.MenuItems>
				</h:ContextMenu>
			</h:ContextMenu.Attached>
		</ContentControl>
	</DataTemplate>

</ResourceDictionary>